package PruebaSonido;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.CardLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import juegoPlayer.Sonidos;
import juegoPlayer.Sonidos;

public class PruebasSonido extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					PruebasSonido frame = new PruebasSonido();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public PruebasSonido() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 109);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton btnNewButton = new JButton("Reproducir normal");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				reproducirNormal();
			}
		});
		btnNewButton.setBounds(10, 11, 124, 23);
		contentPane.add(btnNewButton);
		
		JButton btnNewButton_1 = new JButton("Reproducir en bucle");
		btnNewButton_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				reproducirBucle();
			}
		});
		btnNewButton_1.setBounds(144, 11, 132, 23);
		contentPane.add(btnNewButton_1);
	}

	protected void reproducirBucle() {
		// TODO Auto-generated method stub
		Sonidos s=new Sonidos("C:/ftp/j.wav", true);
		Thread hilo=new Thread(s);
		hilo.start();		
	}

	protected void reproducirNormal() {
		// TODO Auto-generated method stub
		Sonidos s=new Sonidos("C:/ftp/c.mid", false);
		Thread hilo=new Thread(s);
		hilo.start();
	}
}
